<template>
  <view class="statisticsItem">
    <view class="title"> {{ title }}{{ Number(type) ? "收益" : "销售" }} </view>
    <view class="bd">
      <view class="bd-item bd-border" @click="viewInfo">
        <view class="bd-item__top">
          <image
            mode="aspectFit"
            class="icon"
            :src="`${STATIC_URL2}${type ? 'sta' : 'sale'}.png`"
          />
          <view class="text"> 我的 </view>
        </view>
        <!-- <view class="bd-item__bottom"> 56243812.00 </view> -->
        <view class="bd-item__bottom" v-if="item.mine != undefined">
          {{ item.mine.toFixed(2) || 0 }}
        </view>
      </view>
      <view class="bd-item" @click="viewInfo">
        <view class="bd-item__top">
          <image
            mode="aspectFit"
            class="icon"
            :src="`${STATIC_URL2}${type ? 'sta' : 'sale'}.png`"
          />
          <view class="text"> 团队 </view>
        </view>
        <view class="bd-item__bottom" v-if="item.mine != undefined">
          {{ item.team.toFixed(2) || 0 }}
        </view>
      </view>
    </view>
  </view>
</template>
<script>
export default {
  props: {
    type: {
      type: [Number, String],
    },
    title: {
      type: String,
      default: "今日",
    },
    item: {
      type: Object,
      default: {
        mine: 0,
        team: 0,
      },
    },
  },

  data() {
    return {};
  },
  methods: {
    viewInfo() {
      let obj = {
        今日: "today",
        本周: "week",
        本月: "month",
        上月: "last_month",
      };
      let url = Number(this.type)
        ? "/pages/mine/subs/statistics/incomeDetails/incomeDetails?state="
        : "/pages/mine/subs/statistics/staDetails/staDetails?state=";
      uni.navigateTo({
        url:url +obj[this.title],
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.statisticsItem {
  width: 100%;
  background-color: #ffffff;
  border-radius: 12rpx;
  margin-bottom: 25rpx;
  .title {
    font-size: 30rpx;
    font-weight: bold;
    text-align: center;
    line-height: 80rpx;
  }
  .bd {
    @include flex;
    margin-top: 25rpx;
    &-item {
      width: 50%;
      text-align: center;
      &__top {
        display: flex;
        align-items: center;
        justify-content: center;
        .icon {
          width: 40rpx;
          height: 40rpx;
          margin-right: 15rpx;
          margin-left: -50rpx;
        }
        .text {
          font-size: 26rpx;
          position: relative;
          &::before {
            content: "（元）";
            font-size: 22rpx;
            position: absolute;
            left: 50rpx;
            bottom: 0;
          }
        }
      }
      &__bottom {
        font-size: 30rpx;
        font-weight: bold;
        line-height: 100rpx;
      }
    }
    &-border {
      position: relative;
      &::before {
        content: "";
        width: 1rpx;
        height: 70rpx;
        border-right: 1rpx solid #d5d5d5;
        position: absolute;
        right: 0;
        top: 20rpx;
        transform: scaleX(0.5);
      }
    }
  }
}
</style>
